package tiled.mapeditor.widget;

import java.awt.Dimension;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;

public class IntegerSpinner extends JSpinner
{
    public IntegerSpinner()
    {
        super(new SpinnerNumberModel());
        setPreferredSize(new Dimension(60, getPreferredSize().height));
    }

    public IntegerSpinner(int val, int min, int max)
    {
        super(new SpinnerNumberModel(val, min, max, 1));
        setPreferredSize(new Dimension(60, getPreferredSize().height));
    }

    public IntegerSpinner(int val, int min)
    {
        this(val, min, Integer.MAX_VALUE);
    }

    public int intValue()
    {
        return ((Number)getValue()).intValue();
    }
}
